// 路由工具
window.util = {
  // 处理地图缩放
  handleScale: function(pageData, e) {

  },
  
  // 页面导航
  navigateToPage: function(url) {
    try {
      // 增加加载提示
      const loading = document.createElement('div');
      loading.style.position = 'fixed';
      loading.style.top = '50%';
      loading.style.left = '50%';
      loading.style.transform = 'translate(-50%, -50%)';
      loading.style.padding = '10px 20px';
      loading.style.backgroundColor = 'rgba(0,0,0,0.7)';
      loading.style.color = 'white';
      loading.style.borderRadius = '4px';
      loading.style.zIndex = '9999';
       loading.textContent = '加载中...';
      document.body.appendChild(loading);
      
      // 延迟跳转，确保加载提示显示
      setTimeout(() => {
        document.body.removeChild(loading); // 跳转前移除加载提示
        window.location.href = url;
      }, 100);
    } 
    catch (error) {
      console.error('跳转失败:', error);
      alert('跳转失败: ' + error.message);
    }
  },
  
  // 返回上一页
  navigateBack: function() {
    if (window.history.length > 1) {
      window.history.back();
    } else {
      // 回退到首页
      window.location.href = '../pages/main-map/main.html';
    }
  }
};